﻿using System;
using System.Collections.Generic;
using System.Linq;
using QuanLyTiemThuocTay.cls;

namespace QuanLyTiemThuocTay.Report
{
    public partial class rptDanhSachThuoc : DevExpress.XtraReports.UI.XtraReport
    {
        QLTTDataContext db = new QLTTDataContext();
        private int STT; 
        List<THUOC> thuocs;
        public rptDanhSachThuoc()
        {
            InitializeComponent();
            DisplayName = "Danh sách Thuốc - Thiết bị";
            thuocs = db.THUOCs.ToList();
            STT = 0; 
            try
            {
                DataSource = thuocs;
            }
            catch { }
        }

        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            STT++;
            xrTT.Text = STT.ToString();
            try { xrTen.Text = "  " + thuocs[STT - 1].TenThuoc; }
            catch { }
            try { xrDVT.Text = "  " + db.DVTINHs.SingleOrDefault(x => x.MaDVTinh == thuocs[STT - 1].MaDVTinh).TenDVTinh; }
            catch { }
        }
    }
}
